﻿using System;
using UnityEngine;

// Token: 0x02000364 RID: 868
public static class MathfEx
{
	// Token: 0x0600159F RID: 5535 RVA: 0x00092B58 File Offset: 0x00090D58
	public static float LerpAccel(float from, float to, float t)
	{
		return Mathf.Lerp(from, to, Mathf.Sqrt(t));
	}

	// Token: 0x060015A0 RID: 5536 RVA: 0x00092B68 File Offset: 0x00090D68
	public static bool IsRange<T>(T min, T n, T max, bool isEqual) where T : IComparable
	{
		return (!isEqual) ? MathfEx.RangeEqualOff<T>(min, n, max) : MathfEx.RangeEqualOn<T>(min, n, max);
	}

	// Token: 0x060015A1 RID: 5537 RVA: 0x00092B88 File Offset: 0x00090D88
	public static bool RangeEqualOn<T>(T min, T n, T max) where T : IComparable
	{
		return n.CompareTo(max) <= 0 && n.CompareTo(min) >= 0;
	}

	// Token: 0x060015A2 RID: 5538 RVA: 0x00092BC0 File Offset: 0x00090DC0
	public static bool RangeEqualOff<T>(T min, T n, T max) where T : IComparable
	{
		return n.CompareTo(max) < 0 && n.CompareTo(min) > 0;
	}

	// Token: 0x060015A3 RID: 5539 RVA: 0x00092BF4 File Offset: 0x00090DF4
	public static float LerpBrake(float from, float to, float t)
	{
		return Mathf.Lerp(from, to, t * (2f - t));
	}

	// Token: 0x060015A4 RID: 5540 RVA: 0x00092C08 File Offset: 0x00090E08
	public static int LoopValue(ref int value, int start, int end)
	{
		if (value > end)
		{
			value = start;
		}
		else if (value < start)
		{
			value = end;
		}
		return value;
	}

	// Token: 0x060015A5 RID: 5541 RVA: 0x00092C28 File Offset: 0x00090E28
	public static int LoopValue(int value, int start, int end)
	{
		return MathfEx.LoopValue(ref value, start, end);
	}

	// Token: 0x060015A6 RID: 5542 RVA: 0x00092C34 File Offset: 0x00090E34
	public static Rect AspectRect(float baseH = 1280f, float rate = 720f)
	{
		float y = ((float)Screen.height - (float)Screen.width / baseH * rate) * 0.5f / (float)Screen.height;
		float height = rate * (float)Screen.width / baseH / (float)Screen.height;
		return new Rect(0f, y, 1f, height);
	}

	// Token: 0x060015A7 RID: 5543 RVA: 0x00092C84 File Offset: 0x00090E84
	public static long Min(long _a, long _b)
	{
		return (_a <= _b) ? _a : _b;
	}

	// Token: 0x060015A8 RID: 5544 RVA: 0x00092C94 File Offset: 0x00090E94
	public static long Max(long _a, long _b)
	{
		return (_a <= _b) ? _b : _a;
	}

	// Token: 0x060015A9 RID: 5545 RVA: 0x00092CA4 File Offset: 0x00090EA4
	public static long Clamp(long _value, long _min, long _max)
	{
		return MathfEx.Min(MathfEx.Max(_value, _min), _max);
	}

	// Token: 0x060015AA RID: 5546 RVA: 0x00092CB4 File Offset: 0x00090EB4
	public static float ToRadian(float degree)
	{
		return degree * 0.017453292f;
	}

	// Token: 0x060015AB RID: 5547 RVA: 0x00092CC0 File Offset: 0x00090EC0
	public static float ToDegree(float radian)
	{
		return radian * 57.29578f;
	}
}
